package com.app.controller;


import com.app.entity.Notice;
import com.app.service.NoticeService;
import com.app.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author by ltl on 2021/3/18
 */
@RestController
@RequestMapping("/notice")
public class NoticeController {
    @Autowired
    private NoticeService noticeService;

    /**
     * 删除公告
     * @param notice
     * @return
     */
    @PostMapping("/addNotice")
    public Result addNotice(@RequestBody Notice notice) {
        return noticeService.addNotice(notice);
    }

    /**
     * 修改公告
     * @param notice
     * @return
     */
    @PostMapping("/updateNotice")
    public Result updateNotice(@RequestBody Notice notice) {
        return noticeService.updateNotice(notice);
    }
    /**
     * 查询
     */
    @GetMapping("/findNotice")
    public Result findNotice() {
        return noticeService.findNotice();
    }
    /**
     * 激活
     */
    @GetMapping("/activationById/{id}")
    public Result activationById(@PathVariable Integer id) {
        return noticeService.activationById(id);
    }
}
